import { cacheMap } from '@/api/user'
import { getLocal, saveLocal } from '@/utils/'
import { defineStore } from 'pinia'
export const useSystemConfigStore = defineStore('systemSystemConfig', {
  state: (): any => ({
    systemConfig: getLocal('systemConfig'),
  }),
  getters: {},
  actions: {
    setSystemConfig(systemConfig: any) {
      this.systemConfig = systemConfig
      saveLocal('systemConfig', systemConfig)
    },
    getSystemConfig() {
      const params = {
        prefix: 'login_switch',
      }
      cacheMap(params).then((res: any) => {
        this.setSystemConfig(res.data)
      })
    },
  },
})
